import { defineStore } from "pinia";
import { BuildTypeListItem } from "../model";
import { shallowRef } from "vue";

export const useTypeListStore = defineStore("typeListStore", () => {
  const typeListMap = shallowRef<Record<string, BuildTypeListItem>>({});
  const setData = (data: Record<string, BuildTypeListItem>) => {
    typeListMap.value = data;
  };

  const getTypeName = (type: string) => {
    return typeListMap.value[type]?.name;
  };

  return {
    typeListMap,
    setData,
    getTypeName,
  };
});
